<%--
 *  File:    DBArchiveObjects.jsp
 *  @Author: Jamesli
 *  Date:    2010/09/08
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.DBArchiveObjects"); 

  //init param
  String strTableName = "v_archiveobjects";
  String strModuleName = "IGM";
  String privilegeCode = "E0211";
  String contextPath = request.getContextPath();
%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>DBArchiveObjects</title>
<PageFlow:CheckPageFlow pageName="p_dbarcobjectsummary"/>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>
<%
	String closeFlag = request.getParameter("closeflag");
	if(closeFlag!= null && closeFlag.equals("Y")){
%>
		  opener.page_summary('search');
		  window.close();
<%
	}
%>
function page_checkall(){
	var allcheck = cform.checkall;
	var alltable = document.getElementsByName("addtname");
	for(var i = 0 ; i < alltable.length;i++){
		alltable[i].checked = allcheck.checked;
	}
}

function page_uncheckall(element){
	if(!element.checked)cform.checkall.checked = false;
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "DBArchiveObjects.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
  
 function showview(element){ 
	 var x,y; 
	 x = event.clientX; 
	 y = event.clientY; 
	 document.getElementById("floatview").style.left = x; 
	 document.getElementById("floatview").style.top = y; 
	 document.getElementById("floatview").innerHTML = element.value.replace(/</,"&#60"); 
	 if(element.value.length > 17){ 
		document.getElementById("floatview").style.display = "block";
	 }
 } 
 function hiddenview(){ 
	 if(document.getElementById("floatview").style.display == "block"){
		 document.getElementById("floatview").innerHTML = ""; 
		 document.getElementById("floatview").style.display = "none";
	 } 
 }

 function page_add(){
	var alltname = document.getElementsByName("addtname");
	var checkflag = false;
	for(var i = 0 ; i < alltname.length;i++){
		if(alltname[i].checked){
			checkflag = true;
			break;
		}
	}
	if(!checkflag){
		alert("<%= message.getMessageDesc("PLEASE_SELECT")%>");
		return;
	}
	if(!confirm("<%= message.getMessageDesc("SURE_ADD_ARCOBJECTS_2_ARCCTRL") %>")) return;
	
	cform.target = "_self";
	document.cform.actionname.value = "adddbarcbyobjects";
	isRunning = true;
	document.cform.submit();
 }

 var popwindow1;
 function page_textpop(targetname){
	if(popwindow1!=null) popwindow1.close();
	popwindow1 = window.open("<%=contextPath%>/db/dbarc/TextPop4DBArchive.jsp?<%= OvalTools.randomURL() %>&target=" + targetname + "&readonly=Y", "newwindow1", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
 }
</script>
</head>
<body>
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<div id="floatview" style="display:none;position:absolute;z-index:1;background:#fdfddf;border:#cccccc 1px solid;"></div>
<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_dbarcobjectsummary">
	<input type="hidden" name="actionname">
   <tr>
    <td> 
      <table width="100%" border="0" cellspacing="0">  
          <%@ include file="/inc/SummarySearch.inc" %>
       </table>
    </td>
  </tr>
  <tr><td>&nbsp;</td></tr>
  <tr> 
    <td class="td_center"> 
    <div style="width=1050;height=450;padding-left:19px;padding-right:19px;overflow=auto;"> 
      <table width="1300" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
         <tr  class="deepblue-left"> 
            <td width="20" class="title_center"><custom:checkbox property="checkall" styleClass="checkbox" onclick="page_checkall()"/></td>
            <td width="50" class="title_center"><%= label.getLabelName("L_SeqNo") %></td>
            <td width="140" class="title_center"><%= label.getLabelName("L_ParentTable") %></td>
            <td width="140" class="title_center"><%= label.getLabelName("L_ArchiveTable") %></td>
            <td width="140" class="title_center"><%= label.getLabelName("L_ArchiveTablePK") %></td>
            <td width="160" class="title_center"><%= label.getLabelName("L_Archive2Table") %></td>
            <td width="140" class="title_center"><%= label.getLabelName("L_ArchiveTableRK") %></td>
            <td width="*" class="title_center"><%= label.getLabelName("L_ArchiveCondition") %></td>
            <td width="155" class="title_center"><%= label.getLabelName("L_ArchiveConditionDesc") %></td>
            <td width="50" class="title_center"><%= label.getLabelName("L_ArchiveCycle") %></td>
            <td width="50" class="title_center"><%= label.getLabelName("L_ValidOrNot") %></td>
         </tr>
         <%
             int j = 0;
             String strClassType = new String(); 
             Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
             if(totalsummary == null) totalsummary = new Vector();
          %>
          <logic:iterate id="summary" collection="<%= totalsummary %>">                      
         <%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            String strIsChecked = new String("");
            
            if(j%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
              

          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>">
            <td>
            	<%if(summaryMap.get("parenttname") == null || ((summaryMap.get("parenttname")).equals(""))){ %>
            	<custom:checkbox property="tname" name="summary" styleClass="checkbox" changedName="addtname" onclick="page_uncheckall(this)"/>
            	<%}else{ %>
            	&nbsp;
            	<%} %>
            </td>
            <td><custom:write property="seqno" name="summary" nbsp="true"/></td>
            <td><custom:write property="parenttname" name="summary" nbsp="true"/></td>
            <td><custom:write property="tname" name="summary" nbsp="true"/></td>
            <td><custom:write property="tnamepk" name="summary" nbsp="true"/></td>
            <td><custom:write property="arctotname" name="summary" nbsp="true"/></td>
            <td><custom:write property="tnamerk" name="summary" nbsp="true"/></td>
            <td>
            	<%if(summaryMap.get("parenttname") == null || ((summaryMap.get("parenttname")).equals(""))){ %>
            	<custom:text property="arccondition" name="summary" onmouseover="showview(this)" onmouseout="hiddenview()" colIndex="<%=new Integer(j) %>" readonly="true"/><A onclick="page_textpop('arccondition<%=j %>')"><custom:button type="1" label="L_Dots" border="0" style="width:15"/></A>
            	<%}else{ %>
            	&nbsp;
            	<%} %>
            </td>
            <td>
            	<%if(summaryMap.get("parenttname") == null || ((summaryMap.get("parenttname")).equals(""))){ %>
            	<custom:text property="arcconditiondesc" name="summary" onmouseover="showview(this)" onmouseout="hiddenview()" colIndex="<%=new Integer(j) %>" readonly="true"/><A onclick="page_textpop('arcconditiondesc<%=j %>')"><custom:button type="1" label="L_Dots" border="0" style="width:15"/></A>
            	<%}else{ %>
            	&nbsp;
            	<%} %>
            </td>
            <td><custom:write property="arcmonthcnt" name="summary" nbsp="true"/></td>
            <td class="td_center"><%String enableflag = (String)summaryMap.get("enableflag"); %>
            	<%=enableflag.equalsIgnoreCase("Y")?label.getLabelName("L_Yes"):label.getLabelName("L_No")%>
            </td>
          </tr>
          <%
          	j++;      
          %>
          </logic:iterate>
      <% //--------------------------------------  flipping page --%>
      <%@ include file="/inc/SummaryAction.inc" %>
      </table>
      </div>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr> 
          <td class="td_center">
          <%if(j > 0){ %>
          	<a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="edit.gif" border="0" style="width:80"/></a>
          <%} %>
          	<a onclick="javascript:window.close();"><custom:button type="1" label="L_Close" imgsrc="edit.gif" border="0" style="width:80"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
</html>